<template>
<div>
  <div align="left">我的位置&gt;&gt;科技项目申报&gt;项目查询</div>
  <div id="container">
    <div id="content2">
      <table width="100%" height="41" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="15" height="18" align="left" valign="top">
            <div align="left"></div>
          </td>
          <td width="385" align="left" valign="bottom" class="12">&nbsp;</td>
        </tr>
        <tr>
          <td height="4" colspan="2" align="left" valign="bottom"></td>
        </tr>
        <tr>
          <td height="15" align="left" valign="top">&nbsp;</td>
          <td height="15" align="left" valign="top" class="12">
            <table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="20" align="center">
                  <div class="right_proaducts">
                  </div>
                  <div class=padding>
                    <div id=middlebody>
                      <div align="center">
                        <table width="60%" border="0" cellpadding="0" cellspacing="1"
                               bgcolor="#f3f3f3">
                          <tbody>
                          <tr>
                            <td align="center" width="20%" valign="middle">项目内容:</td>
                            <td align="left" width="80%"><input type="text"
                                                                v-model="projectContent.categoryname"
                                                                name="sercontext" size="30">
                            </td>
                          </tr>
                          <tr>
                            <td align="center">开始日期</td>
                            <td align="left"><input type="text" name="startDate" id="temp2"
                                                    v-model="projectContent.repStartTime"
                                                    onFocus="setday(this)"/></td>
                          </tr>
                          <tr>
                            <td align="center">结束日期</td>
                            <td align="left"><input type="text" name="endDate" id="temp3"
                                                    v-model="projectContent.repStopTime"
                                                    onFocus="setday(this)"/></td>
                          <tr>
                            <td align="center">申请资金</td>
                            <td align="left"><input type="text"
                                                    v-model="projectContent.capital" name="money" size="30"></td>
                          </tr>
                          <tr>
                            <td colspan="2" align="center"><input type="button" @click="highSearch()" value="高级查询"
                                                                  style="font-size:8pt">
                            </td>
                          </tr>
                          </tbody>
                        </table>
                        <table width="100%" border="0" cellpadding="0" cellspacing="1">
                          <tbody>
                          <tr>
                            <td align="center" bgcolor="#fba661">主项目</td>
                            <td align="center" bgcolor="#fba661">分项目</td>
                            <td width="208" align="center" bgcolor="#fba661">操作</td>
                          </tr>
                          <tr v-for="(p,index) in projectInfo" :key="index">
                            <td width="150" align="center" bgcolor="#f3f3f3">{{p.categoryname}}</td>
                            <td width="342" align="center" bgcolor="#f3f3f3">
<!--                              <a :href=`../unit/viewprojectinfo1.html?pid=${p.projectId}`>{{p.projectname}}</a>-->
                              <router-link :to="{path:'/declare/unit/viewProjectInfo1',query:{pid:p.projectId}}">{{ p.projectname }}</router-link>
                            </td>
                         <td align="center" bgcolor="#f3f3f3">
<!--<a :href=`../unit/viewprojectinfo.html?pid=${p.projectId}` @click="isClick(p.ispass)" :style="`pointer-events:${p.ispass ==1?'none':'auto'};color:${p.ispass ==1?'gray':'blue'}`">{{p.ispass==1?"专家已评审，不能修改":"没有评审"}}</a>&ndash;&gt;-->
                           <router-link :to="{path:'/declare/unit/viewProjectInfo',query:{pid:p.projectId}}" @click.native="isClick(p.ispass)"
                                        :style="`pointer-events:${p.ispass ==1?'none':'auto'};color:${p.ispass ==1?'gray':'blue'}`">{{ p.ispass == 1 ? "专家已评审，不能修改" : "没有评审" }}</router-link>
                            </td>
                          </tr>
                          </tbody>
                        </table>
                      </div>

                    </div>
                  </div>
                </td>
              </tr>
            </table>
            <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="pagination.currentPage"
                :page-sizes="[1, 2, 4]"
                :page-size="pagination.pageSize"
                layout="prev, pager, next, jumper, total, sizes "
                :total="pagination.total"
            >
            </el-pagination>
            <br/>
            <div class="table_wz"></div>
          </td>
        </tr>
      </table>
    </div>
  </div>
  <div id="container">
    <div id="footer">
      <p><a href="http://www.ascenttech.com.cn/" target="_blank">版权所有：北京亚思晟商务科技有限公司 &copy;2004-2008|京ICP备05005681</a>
      </p>
    </div>

  </div>
</div>
</template>

<script>
export default {
  name: "highSearch",
  data() {
    return {
      projectContent:{
        categoryname:'',
        repStartTime:'',
        repStopTime:'',
        capital:''
      },
      uid: JSON.parse(sessionStorage.getItem("userInfo")).uid || "",
      projectInfo:{},
      pagination: {
        //分页相关模型数据
        currentPage: 1, //当前页码
        pageSize: 4, //每页显示的记录数
        total: 0, //总记录数
        //需要根据查询的条件
        email: "",
        username: "",
        phoneNum: "",
        cordsList: [],
      },
    }
  },
  mounted() {
    // this.simpleSearch();
    this.returnHighSearchPage();
  },
  methods: {
    //注销
    logout() {
      sessionStorage.clear();
    },
    isClick(ispass){
      if(ispass == 1){
        this.$refs.viewProject.style="color:gray;cursor:pointer;pointer-events:none";
      }
    },
    //简单查询
    highSearch(){
      const _this = this;
      this.$axios({
        url:`http://localhost:8080/api/unit/pageCondition/${this.pagination.currentPage}/${this.pagination.pageSize}`,
        method:'post',
        data: _this.projectContent
      }).then((res)=>{
        console.log(res);
        if(res.data.code == 200){
          //将 projectContent保存起来
          sessionStorage.setItem("projectContent",this.projectContent);
          _this.projectInfo = res.data.data.rows;
        }
      })
    },
    /*toHighquery(){
        location.href="./highquery.html"
    },*/
    returnHighSearchPage(){
      if(sessionStorage.getItem("projectContent")){
        this.projectContent = sessionStorage.getItem("projectContent");
        this.highSearch();
        location.reload();
        sessionStorage.removeItem("projectContent");
      }
    },
    handleCurrentChange(currentPage) {
      //修改页码值为当前选中的页码值
      this.pagination.currentPage = currentPage;
      //执行查询
      this.highSearch();
    },

    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pagination.pageSize = val;
      this.highSearch();
    },
  }
}
</script>

<style scoped>
@import "@/assets/css/unit_andreas08(blue).css";
</style>
